package sddengine;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;
import java.awt.image.BufferedImage;
import java.awt.event.KeyEvent;

public class TestGame extends Game{
	

	private PlayerSprite koko;
	private Collision col;
	
	public TestGame() {
		title = "Random title";
		width = 400;
		height = 400;
		col = new Collision();
	}
	
	
	@Override
	public void init() 
        {
            koko = new PlayerSprite(getImages("resources/smurfee.png", 8, 4), 50, 100, 100, this);
        }

	@Override
	public void update() 
        {
            if(koko != null)
            {
                koko.update();
                
            }
		
	}

	@Override
	public void draw(Graphics g)
        {
            if(koko != null)
            {
            	Graphics2D g2d = (Graphics2D) g;

            	Rectangle rect = new Rectangle(100,100, 50, 50);
            	Ellipse2D c = new Ellipse2D.Double(200,100, 50,50);
            	
            	
            	g2d.draw(c);
            	g2d.draw(new Rectangle(new Rectangle(koko.x,koko.y,koko.width,koko.height)));
            	if(col.collidesWith(koko, c)) {
            		System.out.println("collision!");
            		koko.setX(koko.oldX);
            		koko.setY(koko.oldY);
            	}
                koko.draw(g);
            }
            
        }

   
}
		



